/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package it.polimi.se2.meteocal.xml;

import java.sql.Time;
import java.util.Date;
import javax.xml.bind.annotation.adapters.XmlAdapter;
/**
 *
 * @author Ugo
 */
public class TimeAdapter extends XmlAdapter<Date, Time> {
    
      @Override
      public Date marshal(Time v) {
            Date d;
            d = new Date();
            d.setHours(v.getHours());
            d.setMinutes(v.getMinutes());
            d.setSeconds(0);
          return d;
      }
      
      @Override
      public Time unmarshal(Date v) {
          return new Time(v.getHours(),v.getMinutes(),0);
      }
  }

